subdir('d')

r_asm_sources = [
  'asm.c',
  'aop.c',
  'acode.c',
  'aplugs.c',
  'binutils_as.c',
  join_paths('p','asm_6502.c'),
  join_paths('p','asm_6502_cs.c'),
  join_paths('p','asm_8051.c'),
  join_paths('p','asm_amd29k.c'),
#  join_paths('p','asm_arc.c'),
  join_paths('p','asm_arm_as.c'),
  join_paths('p','asm_arm_cs.c'),
  join_paths('p','asm_arm_gnu.c'),
  join_paths('p','asm_arm_winedbg.c'),
  join_paths('p','asm_avr.c'),
  join_paths('p','asm_bf.c'),
  join_paths('p','asm_cr16.c'),
  join_paths('p','asm_cris_gnu.c'),
  join_paths('p','asm_dalvik.c'),
  join_paths('p','asm_dcpu16.c'),
  #join_paths('p','asm_gas.c'),
  join_paths('p','asm_gb.c'),
  join_paths('p','asm_h8300.c'),
  join_paths('p','asm_hexagon.c'),
  #join_paths('p','asm_hexagon_gnu.c'),
  #join_paths('p','asm_hppa_gnu.c'),
  join_paths('p','asm_i4004.c'),
  join_paths('p','asm_i8080.c'),
  join_paths('p','asm_java.c'),
  join_paths('p','asm_lanai_gnu.c'),
  join_paths('p','asm_lh5801.c'),
  join_paths('p','asm_lm32.c'),
  join_paths('p','asm_m68k_cs.c'),
  join_paths('p','asm_m68k_gnu.c'),
  join_paths('p','asm_m680x_cs.c'),
  join_paths('p','asm_malbolge.c'),
  join_paths('p','asm_mcs96.c'),
  join_paths('p','asm_mips_cs.c'),
  join_paths('p','asm_mips_gnu.c'),
  join_paths('p','asm_msp430.c'),
  join_paths('p','asm_nios2.c'),
  join_paths('p','asm_or1k.c'),
  join_paths('p','asm_pic.c'),
  join_paths('p','asm_mcore.c'),
  join_paths('p','asm_ppc_as.c'),
  join_paths('p','asm_ppc_cs.c'),
  join_paths('p','asm_ppc_gnu.c'),
  join_paths('p','asm_propeller.c'),
  join_paths('p','asm_pyc.c'),
  join_paths('p','asm_riscv.c'),
  join_paths('p','asm_rsp.c'),
  join_paths('p','asm_sh.c'),
  join_paths('p','asm_snes.c'),
  join_paths('p','asm_sparc_cs.c'),
  join_paths('p','asm_sparc_gnu.c'),
  join_paths('p','asm_s390_cs.c'),
  join_paths('p','asm_s390_gnu.c'),
  join_paths('p','asm_tms320.c'),
  join_paths('p','asm_tms320c64x.c'),
  join_paths('p','asm_tricore.c'),
  join_paths('p','asm_v810.c'),
  join_paths('p','asm_v850.c'),
  join_paths('p','asm_v850_gnu.c'),
  join_paths('p','asm_vax.c'),
  join_paths('p','asm_wasm.c'),
  join_paths('p','asm_ws.c'),
  join_paths('p','asm_x86_as.c'),
  join_paths('p','asm_x86_cs.c'),
  join_paths('p','asm_x86_nasm.c'),
  join_paths('p','asm_x86_nz.c'),
  #join_paths('p','asm_x86_vm.c'),
  join_paths('p','asm_xap.c'),
  join_paths('p','asm_xcore_cs.c'),
  # join_paths('p','asm_xtensa.c'),
  join_paths('p','asm_z80.c'),
  join_paths('p','asm_jdh8.c'),
  #join_paths('arch','6502','6502dis.c'),
  join_paths('arch','amd29k','amd29k.c'),
  #join_paths('arch','8051','8051_disas.c'),
  join_paths('arch','8051','8051_ass.c'),
  join_paths('arch','v850','gnu','v850-dis.c'),
  join_paths('arch','v850','gnu','v850-opc.c'),
  #join_paths('arch','arc','gnu','arc-dis.c'),
  #join_paths('arch','arc','gnu','arc-ext.c'),
  #join_paths('arch','arc','gnu','arc-opc.c'),
  #join_paths('arch','arc','gnu','arcompact-dis.c'),
  join_paths('arch','arm','aarch64','aarch64-dis-2.c'),
  join_paths('arch','arm','aarch64','aarch64-dis.c'),
  join_paths('arch','arm','aarch64','aarch64-opc-2.c'),
  join_paths('arch','arm','aarch64','aarch64-opc.c'),
  join_paths('arch','arm','armass.c'),
  join_paths('arch','arm','armass64.c'),
  join_paths('arch','arm','gnu','arm-dis.c'),
  join_paths('arch','arm','gnu','floatformat.c'),
  join_paths('arch','arm','winedbg','be_arm.c'),
  join_paths('arch','avr','avr_disasm.c'),
  join_paths('arch','avr','format.c'),
  join_paths('arch','avr','disasm.c'),
  join_paths('arch','avr','assemble.c'),
  join_paths('arch','cr16','cr16_disas.c'),
  join_paths('arch','cris','gnu','cris-dis.c'),
  join_paths('arch','cris','gnu','cris-opc.c'),
  #join_paths('arch','dcpu16','asm.c'),
  #join_paths('arch','dcpu16','dis.c'),
  #join_paths('arch','dcpu16','main.c'),
  #join_paths('arch','gb','gbasm.c'),
  #join_paths('arch','gb','gbdis.c'),
  join_paths('arch','h8300','h8300_disas.c'),
  join_paths('arch','hexagon','hexagon.c'),
  join_paths('arch','hexagon','hexagon_disas.c'),
  #join_paths('arch','hexagon','gnu','hexagon-dis.c'),
  #join_paths('arch','hexagon','gnu','hexagon-opc.c'),
  #join_paths('arch','hexagon','gnu','safe-ctype.c'),
  #join_paths('arch','hppa','gnu','hppa-dis.c'),
  #join_paths('arch','i4004','i4004dis.c'),
  #join_paths('arch','i8080','i8080dis.c'),
  join_paths('arch','lanai','gnu','lanai-dis.c'),
  join_paths('arch','lanai','gnu','lanai-opc.c'),
  join_paths('arch','m68k','gnu','m68k-dis.c'),
  join_paths('arch','m68k','gnu','m68k-opc.c'),
  join_paths('arch','mips','gnu','mips-dis.c'),
  join_paths('arch','mips','gnu','mips-opc.c'),
  join_paths('arch','mips','gnu','mips16-opc.c'),
  join_paths('arch','mips','gnu','micromips-opc.c'),
  join_paths('arch','mips','mipsasm.c'),
  join_paths('arch','msp430','msp430_disas.c'),
  join_paths('arch','nios','gnu','nios2-dis.c'),
  join_paths('arch','nios','gnu','nios2-opc.c'),
  join_paths('arch','or1k','or1k_disas.c'),
  join_paths('arch','pic','pic_baseline.c'),
  join_paths('arch','pic','pic_midrange.c'),
  join_paths('arch','pic','pic_pic18.c'),
  join_paths('arch','mcore','mcore.c'),
  join_paths('arch','s390','gnu','s390-dis.c'),
  join_paths('arch','s390','gnu','s390-opc.c'),
  join_paths('arch','ppc','gnu','ppc-dis.c'),
  join_paths('arch','ppc','gnu','ppc-opc.c'),
  join_paths('arch','ppc','libvle','vle.c'),
  join_paths('arch','ppc','libps','libps.c'),
  join_paths('arch','propeller','propeller_disas.c'),
  join_paths('arch','pyc','opcode_all.c'),
  join_paths('arch','pyc','opcode_anal.c'),
  join_paths('arch','pyc','opcode_arg_fmt.c'),
  join_paths('arch','pyc','opcode.c'),
  join_paths('arch','pyc','pyc_dis.c'),
  #join_paths('arch','riscv','riscv-opc.c'),
  #join_paths('arch','riscv','riscv.c'),
  join_paths('arch','rsp','rsp_idec.c'),
  join_paths('arch','sh','gnu','sh-dis.c'),
  #join_paths('arch','snes','snesdis.c'),
  join_paths('arch','sparc','gnu','sparc-dis.c'),
  join_paths('arch','sparc','gnu','sparc-opc.c'),
  join_paths('arch','tms320','c55x_plus','c55plus.c'),
  join_paths('arch','tms320','c55x_plus','c55plus_decode.c'),
  join_paths('arch','tms320','c55x_plus','decode_funcs.c'),
  join_paths('arch','tms320','c55x_plus','hashtable.c'),
  #join_paths('arch','tms320','c55x_plus','hashvector.c'),
  join_paths('arch','tms320','c55x_plus','ins.c'),
  join_paths('arch','tms320','c55x_plus','utils.c'),
  join_paths('arch','tms320','tms320_dasm.c'),
  join_paths('arch','tricore','gnu','cpu-tricore.c'),
  join_paths('arch','tricore','gnu','tricore-dis.c'),
  join_paths('arch','tricore','gnu','tricore-opc.c'),
  join_paths('arch','v810','v810_disas.c'),
  join_paths('arch','v850','v850_disas.c'),
  join_paths('arch','vax','vax-dis.c'),
  join_paths('arch','wasm','wasm.c'),
  join_paths('arch','whitespace','wsdis.c'),
  # join_paths('arch','xap','dis.c'),
  # join_paths('arch','xtensa','gnu','elf32-xtensa.c'),
  # join_paths('arch','xtensa','gnu','xtensa-dis.c'),
  # join_paths('arch','xtensa','gnu','xtensa-isa.c'),
  # join_paths('arch','xtensa','gnu','xtensa-modules.c'),
  #join_paths('arch','z80','expressions.c'),
  join_paths('arch','z80','z80.c'),
  #join_paths('arch','z80','z80asm.c'),
  #join_paths('arch','jdh8','jdh8dis.c'),
]

r_asm_inc = [
  platform_inc,
  include_directories(
    join_paths('..','..','shlr'),
    join_paths('arch','include'),
    join_paths('arch'),
    join_paths('arch','h8300'),
    join_paths('arch','hexagon'),
    join_paths('arch','msp430'),
    join_paths('arch','rsp'),
    join_paths('arch','mcore'),
    join_paths('arch','v850'),
    join_paths('arch','propeller'),
    join_paths('arch','cr16'),
    join_paths('arch','8051'),
    join_paths('arch','v810'),
    join_paths('arch','or1k')
  )
]

if get_option('sdb_cgen')
  r_asm_sources += r_asm_d_sources
endif

r_asm = library('r_asm', r_asm_sources,
  include_directories: r_asm_inc,
  c_args: library_cflags,
  dependencies: [
    r_util_dep,
    r_syscall_dep,
    r_parse_dep,
    r_lang_dep,
    r_flag_dep,
    r_socket_dep,
    capstone_dep,
    java_dep
  ],
  install: true,
  implicit_include_directories: false,
  install_rpath: rpath_lib,
  soversion: r2_libversion
)

r_asm_dep = declare_dependency(link_with: r_asm,
                               include_directories: r_asm_inc)

pkgconfig_mod.generate(r_asm,
  subdirs: 'libr',
  version: r2_version,
  name: 'r_asm',
  filebase: 'r_asm',
  libraries: pkgcfg_sanitize_libs,
  requires: [
    'r_util',
    'r_syscall',
    'r_parse',
    'r_lang',
    'r_flag',
    'r_socket'
  ],
  description: 'radare foundation libraries'
)
